import Vue from "vue";
import Vuex from "vuex";
import ble from "./modules/ble"
import wifi from "./modules/wifi"

Vue.use(Vuex);

const state = {
  statusBarHeight: 24, //状态栏高度
  isDarkMode: false,//是否暗黑模式
  isIos: '',//是否ios平台
};

const mutations = {
  setStatusBarHeight(state, data) {
    state.statusBarHeight = data;
  },
  setIsDarkMode(state, data) {
    state.isDarkMode = data;
  },
  setIsIos(state, data) {
    state.isIos = data;
  }
};

const getters = {
  getStatusBarHeight(state) {
    return state.statusBarHeight;
  },
  getIsDarkMode(state) {
    return state.isDarkMode;
  },
  getIsIos(state) {
    return state.isIos;
  },
  getImagePath(state) {
    return state.isDarkMode ? 'dark/' : 'light/';
  }
};

const actions = {
  setStatusBarHeight(context, data) {
    context.commit('setStatusBarHeight', data);
  },
  setIsIos(context, data) {
    context.commit('setIsIos', data);
  },
  setIsDarkMode(context, data) {
    context.commit('setIsDarkMode', data);
  },
}

const modules = {
  ble, wifi
};

export default new Vuex.Store({
 
  state,
  mutations,
  actions,
  getters,
  modules
});
